<%
layout("/include/_dialog.html"){
%>
<script type="text/javascript">
    $(document).ready(function () {
        $('#start').datetimepicker({
            format: 'Y-m-d H:i'
        });
        $('#end').datetimepicker({
            format: 'Y-m-d H:i'
        });
        //提交表单
    });

    //删除事件
    function del(index, calendar) {
        jp.confirm("确定要删除该事件吗？", function () {
            var eventid = $("#eventid").val();
            $.post("${ctx }/myCalendar/del", {id: eventid}, function (result) {
                if (result.success) {//删除成功
                    jp.info(result.msg);
                    calendar.fullCalendar('removeEvents', [eventid]);
                    jp.close(index);
                } else {
                    jp.alert(result.msg);
                }
            });

        })
    };

    function save(index, calendar) {
        var isValidate = jp.validateForm('#inputForm');//校验表单
        if (!isValidate) {
            return false;
        }
        $.post("${ctx }/myCalendar/save", $('#inputForm').serialize(), function (result) {
            if (result.success) {//删除成功
                jp.info(result.msg);
                calendar.fullCalendar('refetchEvents'); //重新获取所有事件数据
                jp.close(index);
            } else {
                jp.alert(result.msg);
            }
        });

    };
</script>
<form id="inputForm" method="post" class="form-horizontal p-10">
    <input type="hidden" name="id" id="eventid" value="${myCalendar.id}">
    <div class="form-group row">
        <label class="col-sm-2 control-label"><font color="red">*</font>日程内容：</label>
        <div class="col-sm-10">
            <input type="text" class=" form-control required" name="title" id="title" placeholder="记录你将要做的一件事..."
                   value="${myCalendar.title}">
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-2 control-label"><font color="red">*</font>开始时间：</label>
        <div class="col-sm-10">
                    <input readonly="" id="start" name="start"
                           value='${myCalendar.start!,dateFormat="yyyy-MM-dd hh:mm:ss"}' placeholder="请选择日期"
                           class=" form-control required">
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-2 control-label"><font color="red">*</font>结束时间：</label>
        <div class="col-sm-10">
                    <input readonly="" id="end" name="end" value='${myCalendar.end!,dateFormat="yyyy-MM-dd hh:mm:ss"}'
                           placeholder="请选择日期" class=" form-control required">
        </div>
    </div>
</form>
<% } %>